home *** CD-ROM | disk | FTP | other *** search
- #include <genstub.c>
-
- #define LISTBOX_ID 1000
-
- LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- switch (uMsg)
- {
- case WM_CREATE: // Create list box child window to show section keys.
- {
- RECT rectClient;
- LRESULT lRetVal = DefWindowProc(hWnd, uMsg, wParam, lParam);
- GetClientRect( hWnd, &rectClient ); // Use client rectangle to center child.
- CreateWindow( "listbox", // listbox class
- "child listbox", // name
- WS_CHILD | WS_VISIBLE | LBS_STANDARD, // style
- 10, 10, // location
- rectClient.right - rectClient.left - 20, // width
- rectClient.bottom - rectClient.top - 20, // height
- hWnd, // parent
- (HMENU) LISTBOX_ID, // child window ID
- hInst, // app instance
- NULL ); // special parameters
- return lRetVal;
- }
- case WM_COMMAND:
- switch ( LOWORD( wParam ) )
- {
- case IDM_TEST:
- {
- LPTSTR lpTemp = GetEnvironmentStrings( );
- HWND hWndListBox = GetDlgItem( hWnd, LISTBOX_ID );
- if ( hWndListBox )
- {
- SendMessage( hWndListBox, LB_RESETCONTENT, 0, 0 );
- while ( *lpTemp )
- {
- SendMessage( hWndListBox, LB_ADDSTRING, 0, (LPARAM) lpTemp );
- lpTemp += lstrlen(lpTemp) + 1; // jump past null
- }
- }
- }
- break;
- case IDM_EXIT:
- DestroyWindow( hWnd );
- break;
- }
- break;
- case WM_DESTROY:
- PostQuitMessage( 0 );
- break;
- default:
- return (DefWindowProc(hWnd, uMsg, wParam, lParam));
- }
- return( NULL );
- }